package com.ahy231.mapper;

import com.ahy231.entity.UserRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

/**
 * @author ahy231
 * @date 2021/7/26 10:26
 * @description
 */
@Mapper
public interface UserRoleMapper extends BaseMapper<UserRole> {

    @Insert("INSERT INTO user_role (user_id, role_id) VALUE (#{userId}, (SELECT role_id FROM role WHERE role = #{role}))")
    int addUserRole(long userId, String role);
}
